package com.zrrd.spring_04.service.impl;

import com.zrrd.spring_04.dao.ManagerDao;
import com.zrrd.spring_04.service.ManagerService;
import org.springframework.stereotype.Service;

import javax.annotation.PostConstruct;
import javax.annotation.PreDestroy;
import javax.annotation.Resource;

/**
 * @author WanJl
 * @version 1.0
 * @title ManagerServiceImpl
 * @description
 * @create 2024/10/31
 */
@Service
public class ManagerServiceImpl implements ManagerService {
    @Resource
    private ManagerDao managerDao;

    @Override
    public void save() {
        System.out.println("新增管理员.....Service层");
        managerDao.save();
    }

    @Override
    public void remove() {
        System.out.println("删除管理员.....Service层");
        managerDao.remove();
    }

    @Override
    public void edit() {
        System.out.println("修改管理员.....Service层");
        managerDao.edit();
    }

    @Override
    public void query() {
        System.out.println("查询管理员.....Service层");
        managerDao.query();
    }

    /**
     * @PostConstruct 该注解用来修饰某个方法，让本方法在当前bean初始化后立即执行的操作
     */
    @PostConstruct
    public void init(){
        System.out.println("managerService的初始化后执行的操作.....");
    }

    /**
     * @PreDestroy 该注解用来修饰某个方法，让本方法在当前bean销毁前执行的操作
     */
    @PreDestroy
    public void destroy(){
        System.out.println("managerService销毁前执行的操作.....");
    }
}
